package cn.iocoder.yudao.module.crossborder.order.dal.mysql.ordermain;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.order.dal.dataobject.ordermain.OrderMainDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.order.controller.admin.ordermain.vo.*;

/**
 * 跨境电商订单主 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderMainMapper extends BaseMapperX<OrderMainDO> {

    default PageResult<OrderMainDO> selectPage(OrderMainPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderMainDO>()
                .eqIfPresent(OrderMainDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(OrderMainDO::getPlatformOrderId, reqVO.getPlatformOrderId())
                .eqIfPresent(OrderMainDO::getPlatformOrderNo, reqVO.getPlatformOrderNo())
                .eqIfPresent(OrderMainDO::getPlatformId, reqVO.getPlatformId())
                .eqIfPresent(OrderMainDO::getStoreId, reqVO.getStoreId())
                .eqIfPresent(OrderMainDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(OrderMainDO::getCustomerNo, reqVO.getCustomerNo())
                .eqIfPresent(OrderMainDO::getOrderType, reqVO.getOrderType())
                .eqIfPresent(OrderMainDO::getOrderSource, reqVO.getOrderSource())
                .eqIfPresent(OrderMainDO::getSalesChannel, reqVO.getSalesChannel())
                .eqIfPresent(OrderMainDO::getOrderStatus, reqVO.getOrderStatus())
                .eqIfPresent(OrderMainDO::getPaymentStatus, reqVO.getPaymentStatus())
                .eqIfPresent(OrderMainDO::getFulfillmentStatus, reqVO.getFulfillmentStatus())
                .eqIfPresent(OrderMainDO::getCurrencyCode, reqVO.getCurrencyCode())
                .eqIfPresent(OrderMainDO::getExchangeRate, reqVO.getExchangeRate())
                .eqIfPresent(OrderMainDO::getBaseCurrency, reqVO.getBaseCurrency())
                .eqIfPresent(OrderMainDO::getItemCount, reqVO.getItemCount())
                .eqIfPresent(OrderMainDO::getTotalQuantity, reqVO.getTotalQuantity())
                .eqIfPresent(OrderMainDO::getSubtotalAmount, reqVO.getSubtotalAmount())
                .eqIfPresent(OrderMainDO::getShippingAmount, reqVO.getShippingAmount())
                .eqIfPresent(OrderMainDO::getTaxAmount, reqVO.getTaxAmount())
                .eqIfPresent(OrderMainDO::getDutyAmount, reqVO.getDutyAmount())
                .eqIfPresent(OrderMainDO::getInsuranceAmount, reqVO.getInsuranceAmount())
                .eqIfPresent(OrderMainDO::getHandlingFee, reqVO.getHandlingFee())
                .eqIfPresent(OrderMainDO::getDiscountAmount, reqVO.getDiscountAmount())
                .eqIfPresent(OrderMainDO::getCouponAmount, reqVO.getCouponAmount())
                .eqIfPresent(OrderMainDO::getPointsAmount, reqVO.getPointsAmount())
                .eqIfPresent(OrderMainDO::getAdjustmentAmount, reqVO.getAdjustmentAmount())
                .eqIfPresent(OrderMainDO::getTotalAmount, reqVO.getTotalAmount())
                .eqIfPresent(OrderMainDO::getPaidAmount, reqVO.getPaidAmount())
                .eqIfPresent(OrderMainDO::getRefundAmount, reqVO.getRefundAmount())
                .eqIfPresent(OrderMainDO::getPointsEarned, reqVO.getPointsEarned())
                .eqIfPresent(OrderMainDO::getPointsUsed, reqVO.getPointsUsed())
                .betweenIfPresent(OrderMainDO::getOrderTime, reqVO.getOrderTime())
                .betweenIfPresent(OrderMainDO::getConfirmTime, reqVO.getConfirmTime())
                .betweenIfPresent(OrderMainDO::getPaymentTime, reqVO.getPaymentTime())
                .betweenIfPresent(OrderMainDO::getShipTime, reqVO.getShipTime())
                .betweenIfPresent(OrderMainDO::getDeliveryTime, reqVO.getDeliveryTime())
                .betweenIfPresent(OrderMainDO::getCompleteTime, reqVO.getCompleteTime())
                .betweenIfPresent(OrderMainDO::getCancelTime, reqVO.getCancelTime())
                .eqIfPresent(OrderMainDO::getCancelReason, reqVO.getCancelReason())
                .betweenIfPresent(OrderMainDO::getExpectedDeliveryDate, reqVO.getExpectedDeliveryDate())
                .eqIfPresent(OrderMainDO::getDeliveryDeadline, reqVO.getDeliveryDeadline())
                .eqIfPresent(OrderMainDO::getAutoConfirmDays, reqVO.getAutoConfirmDays())
                .eqIfPresent(OrderMainDO::getBuyerMessage, reqVO.getBuyerMessage())
                .eqIfPresent(OrderMainDO::getSellerMessage, reqVO.getSellerMessage())
                .eqIfPresent(OrderMainDO::getInternalNotes, reqVO.getInternalNotes())
                .eqIfPresent(OrderMainDO::getRiskScore, reqVO.getRiskScore())
                .eqIfPresent(OrderMainDO::getRiskLevel, reqVO.getRiskLevel())
                .eqIfPresent(OrderMainDO::getFraudCheckStatus, reqVO.getFraudCheckStatus())
                .eqIfPresent(OrderMainDO::getIsUrgent, reqVO.getIsUrgent())
                .eqIfPresent(OrderMainDO::getIsGift, reqVO.getIsGift())
                .eqIfPresent(OrderMainDO::getGiftMessage, reqVO.getGiftMessage())
                .eqIfPresent(OrderMainDO::getIsDropshipping, reqVO.getIsDropshipping())
                .eqIfPresent(OrderMainDO::getTags, reqVO.getTags())
                .betweenIfPresent(OrderMainDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderMainDO::getId));
    }

}